<style lang="scss" scoped>
	.content {
		padding: 30rpx;
	}

	.list {
		width: 690rpx;
		height: 476rpx;
		background: #ffffff;
		border: 2rpx solid #f7f7f7;
		border-radius: 26rpx;
		box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(0, 0, 0, 0.08);
		padding: 20rpx;
		line-height: 60rpx;

		.contains {
			margin-top: 30rpx;
		}

		.bottom {
			height: 80rpx;
			border-top: 1px solid #eee;
			margin-top: 30rpx;
		}

	}
</style>

<template>
	<view class="content">
		<Desk :data="data.serve"></Desk>
		
		
		<u-tabbar  :before-switch="tabbarBeforeSwitch"  :list="tabBarList" :value="1" active-color="#409eff" :mid-button="true"></u-tabbar>
		<!-- <view v-if="list.length>0" class="list m-bottom20"  v-for="item,index in list" :key="index">
			<view class="head between-flex">
				<view class="f36 bold">运维日报</view>
				<view class="ccc">{{item.time}}</view>
			</view>
			<view class="contains">
				<view>通话{{item.value.accept+item.value.exhale}}次 (来电{{item.value.missed+item.value.accept}}次, 呼出{{item.value.exhale}}次, 未接{{item.value.missed}}次)</view>
				<view>创建工单{{item.value.create}}个</view>
				<view>完成工单{{item.value.complete}}个</view>
				<view>电话找人{{item.value.look}}次</view>
			</view>
			<view class="bottom between-flex" @click="go(item.time,item.value)">
				<view class="f28 blue">查看更多详情</view>
				<view><u-icon name="arrow-right" color="#409EFF" size="28"></u-icon></view>
			</view>
		</view> -->
<ScanCodeDialog ref="ScanCodeDialog" v-model="scanCodeDialogVisble" :code="scanValue" ></ScanCodeDialog>
	</view>
</template>

<script>
	import ScanCodeDialog from '@/components/scanCodePopUp/index.vue'
	import Desk from './components/card/desk.vue'
	import { getServeData } from '@/apis/daily.js'
	import {tabbarConfig} from '@/common/tabbarConfig.js'
	export default {
		components: {
			Desk,
			ScanCodeDialog
		},
		data() {
			return {
				scanValue:'',
				tabBarList:tabbarConfig,
				scanCodeDialogVisble:false,
				head: this.$head,
				list: [],
				// 数据
				data: {
					serve: null
				},
				nomore: false
			}
		},
		onShow() {
			if (uni.getStorageSync('token')) {
				// this.getlist()
				this.initData()
			} else {
				this.list = []
				this.nomore = true
			}

		},
		methods: {
			
			tabbarBeforeSwitch(index) {
			 if (index === 1) {
			 this.$refs.ScanCodeDialog.scanCode()  
			 }
			 return true
			},
			initData() {
				wx.showLoading({
					title: '加载中...'
				})
				let time = this.$options.filters.date(Date.now())
				getServeData(time).then((res) => {
					if (res.code == 0) {
						this.$set(this.data, 'serve', res.body)
						wx.hideLoading()
					}
				})
			},
			getlist() {
				this.$pop.ajaxPost('/busOrderStatistics/getOrderTotalList').then(res => {
					if (res.code == 0) {
						var list = res.body.list

						list.forEach(item => {
							item.value = JSON.parse(item.value)
						})
						this.list = list
						this.list.length == 0 ? this.nomore = true : this.nomore = false
					}
				})
			},
			go(date, value) {
				uni.setStorageSync('value', value)
				this.$navTo('/pages/news/info?date=' + date)
			}

		}
	}
</script>
